import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class HashMapIterate{
    public static void main(String[] args){
        HashMap<Integer, String> hMap = new HashMap<Integer, String>();
        hMap.put(1, "aaa");
        hMap.put(2, "bbb");
        hMap.put(3, "ccc");
        hMap.put(1, "ddd");
        
        System.out.println("size: " + hMap.size());
        
        Iterator<Map.Entry<Integer, String>> iter = hMap.entrySet().iterator();
        while(iter.hasNext()){
            Map.Entry<Integer, String> en = iter.next();
            System.out.println(en.getKey() + " : " + en.getValue());
        }
    }
}